package cn.gson.oasys.services.user.impl;

import cn.gson.oasys.model.dao.user.UserDao;
import cn.gson.oasys.model.entity.user.User;
import cn.gson.oasys.services.user.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    //记日志
    Logger log = LoggerFactory.getLogger(getClass());

    //根据用户名和密码获取用户信息
    @Override
    public User getUserByNameAndPwd(String userName, String password) {
        return userDao.findOneUser(userName, password);
    }

    //根据用户id获取用户信息
    @Override
    public User getUserById(Long userId) {
        return userDao.findOne(userId);
    }
}
